-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heed NO_COLOR environment variable #8693
Conversation
static bool is_nocolor() | ||
{ | ||
static const char *no_color_var = getenv("NO_COLOR"); | ||
static const bool no_color = no_color_var && *no_color_var; // apparently, NO_COLOR=0 means no color too (as per no-color.org) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use strtol
to check the actual numeric value if you want to compare with 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to compare with 0, 0 apparently means the same as 1 or yes or no (according to the page). The contents do not matter, only their existence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've just read the docs too and it explicitly say "any non-empty string", so it's better to leave the code as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me! The only xterm control sequences produced with this PR + the env variable are bracketed paste sequences.
I had no idea what bracketed paste sequences were. Having looked that up, I have no idea what could be generating those, wikipedia says it's a tty thing. Where do you see those ? |
I tried looking for what could be generating those sequences as well without luck. The sequence is
Linux is Maybe it's a |
Maybe related: pexpect/pexpect#669 |
Could we please get this opened against release? |
No description provided.